<?php
GLOBAL $m, $a, $project_id, $f, $min_view, $query_string, $durnTypes;
GLOBAL $task_sort_item1, $task_sort_type1, $task_sort_order1;
GLOBAL $task_sort_item2, $task_sort_type2, $task_sort_order2;
GLOBAL $dPconfig;

$q = new DBQuery();
$q->addTable('tasks');
$q->addWhere('(task_quotation is null or task_quotation < 1)');
$projects = $q->loadList();

$statList = array("" => "");
$typeList = array("" => "");
$customerList = array("" => "");
$shipTypeList = array("" => "");
?>
<table cellspacing="0" cellpadding="4" border="0" width="100%" class="infopanel">
<tr>
	<td>
		<input class="button" type="submit" name="searchAction" value="<?=$AppUI->_('search');?>"/>
		<input class="button" type="reset" name="resetAction" value="<?=$AppUI->_('reset');?>"/>
	</td>
</tr>
</table>
<table cellspacing="0" cellpadding="4" border="0" width="100%" class="subinfopanel">
<tr>
	<td align="right"><?=$AppUI->_('Code')?></td>
	<td>
		<input type="text" class="text" name="quote_code" id="quote_code" value="<?=$quote_code?>" maxlength="50"/>
	</td>
	<td align="right"> <?=$AppUI->_('Status')?></td>
	<td width="60%">
		<?= arraySelect($statList, 'quote_status', ' id="quote_status" size="1" class="text" style="width: 135px;"', $quote_status, true)?>
	</td>
</tr>
<tr>
	<td nowrap="nowrap" align="right"><?=$AppUI->_('Name')?></td>
	<td>
		<input type="text" class="text" name="quote_name" id="quote_name" value="<?=$quote_name?>" maxlength="50"/>
	</td>
	<td align="right"><?=$AppUI->_('Type')?></td>
	<td><?= arraySelect($typeList, 'quote_type', ' id="quote_type" size="1" class="text" style="width: 135px;"', $quote_type, true)?></td>
</tr>
<tr>
	<td align="right"><?=$AppUI->_('Customer')?></td>
	<td><?= arraySelect($customerList, 'quote_customer', ' id="quote_customer" size="1" class="text" style="width: 200px;"', $quote_customer, true)?></td>
	<td nowrap="nowrap" align="right"><?=$AppUI->_('Shipping Type')?></td>
	<td>
		<?= arraySelect($shipTypeList, 'quote_shipping_type', ' id="quote_shipping_type" size="1" class="text" style="width: 135px;"', $quote_shipping_type, true)?>
	</td>
</tr>
</table>
</form>
	<script type="text/javascript">
		function submitForm(offset) {
			document.searchFrm.offset.value = offset;
			document.searchFrm.submit();
		}
	</script>
	<table id="idQuotationList" class="list" cellspacing="0" cellpadding="2" border="0" width="100%">
		<tr class="<?=($i % 2 == 0) ? "second" : "first" ?>">
			<th ><?=$AppUI->_('Customer')?></th>
			<th ><?=$AppUI->_('Reference')?></th>
			<th ><?=$AppUI->_('Code')?></th>
			<th ><?=$AppUI->_('Name')?></th>
			<th ><?=$AppUI->_('Status')?></th>
			<th ><?=$AppUI->_('Type')?></th>
			<th ><?=$AppUI->_('Shipping type')?></th>
		</tr>
	<?
	foreach ($projects as $row) {
		$i++;
		?>
		<tr class="<?=($i % 2 == 0) ? "second" : "first" ?>" onClick="showTask(<?=$row['task_id']?>)">
			<td ><?=@$row['company_name']?></td>
			<td ><?=@$row['reference_name']?></td>
			<td ><?=@$row['task_code']?></td>
			<td ><?=@$row['task_name']?></td>
			<td ><?=@$row['status_name']?></td>
			<td ><?=@$row['type_name']?></td>
			<td ><?=@$row['shipping_type_name']?></td>
		</tr>
		<?
	}
	?>
	</table>
<script>
	Calendar.enabled = true;

	Table("idQuotationList").setNormalHover(1);

	function showTask(id)
	{
		location.href = "index.php?m=tasks&a=view&task_id=" + id;
	}
</script>